package com.xu.logger;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

import com.llx.logger.LogWindow;
import com.llx.logger.WindowAccess;
import com.llx.use.Logger;
import com.llx.use.Threads;
import com.llx.use.Use;
import com.llx.use.Viewer;


public class MainActivity extends AppCompatActivity implements View.OnClickListener{//, me.jessyan.autosize.internal.CancelAdapt {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Use.init(this);

        setContentView(R.layout.activity_main);


        findViewById(R.id.submit).setOnClickListener(this);
        findViewById(R.id.window).setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.submit:
                EditText editText = findViewById(R.id.input);
                Logger.info(editText.getText().toString());
                Threads.ui(() -> {
                    Logger.info(editText.getText().toString());
                }, 500);

                //Logger.stackTracePrint();
                break;
            case R.id.window:
                Logger.w(Viewer.dip2px(1920));
                LogWindow.open(this);
                //LogWindow.open(this, Viewer.dip2px(1920) / 1920f);
                //Intent intent = new Intent();
                //intent.setClass(this, SubActivity.class);
                //startActivity(intent);
                break;
        }
    }
}